<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
  <style>
    div{
      width: 300px;
      background-color: rgba(0,0,0,0.3);
      padding: 10px;
      position: relative;/*相对位置*/
    }
    input[type='text']{
      width: 260px;
      padding: 10px 20px;
      border:none;/*去掉边框*/
    }
    img{
      position: absolute;/*相对于div,自身位置改变后,后面自动顶上来,因此用absolute*/
      right: 30px;
      top:14px;

    }
    p{
      font-size: 12px;
      color: red;
      margin:0;
    }
  </style>
</head>
<body>
<div>
  <input type="text" placeholder="请输入您的用户名">
  <img src="http://doc.canglaoshi.org/tstore_v1/images/login/yhm.png" alt="">
  <p>用户名不能为空!</p>
</div>
</body>
</html>